function [fircoef]=calzfir(amp, ang, N, df, lineara)
  M = N + 1;
  for k = 0: N/2
    if(lineara == 1)
      phase = -pi*(k) * N /M;
    else
      phase = -ang(k + 1);%-pi*(k) * N /M;
    end
    f(k + 1) = amp(k + 1) * cos(phase) + amp(k + 1) * sin(phase) * 1j;
    if(k > 0)
      an(k + 1) = phase / (2 * pi * k * df);
    else
      an(k + 1) = 0;
    end
  end
  for k = 1:(N/2 - 1)
    f(N -k + 1) = real(f(k + 1)) - imag(f(k + 1)) * 1j;
  end
  fircoef = real(ifft(f));
end
